'''
Created on 07.08.2011

@author: osman
'''

from pets_ontology import Pets, Pet, Cat, Dog
from people_ontology import Person

# define new predicate for pets:
@Pets.atomic
def hasOwner(pet: Pet, owner: Person) -> 'has owner':
    return True

with Pets:
    # instantiate some pets:
    Tiger = Cat("Tiger")
    Oscar = Cat("Oscar")
    Robert = Person("Robert")
    Max = Dog("Max")
    
    # add correct predicate
    hasOwner(Tiger, Robert)
    hasOwner(Oscar, Robert)

for arc in Pets.find(predicate = hasOwner):
    print(arc)

print("Pets.find(predicate = hasOwner): ",
      tuple(Pets.find(predicate = hasOwner)))
print("Pets.find(predicate = hasOwner, owner = Robert): ",
      tuple(Pets.find(predicate = hasOwner, owner = Robert)))
print("Pets.find(pet = Tiger, predicate = hasOwner, owner = Robert): ",
      tuple(Pets.find(pet = Tiger, predicate = hasOwner, owner = Robert)))
print("Pets.match(pet = Tiger, predicate = hasOwner, owner = Robert): ",
      Pets.match(pet = Tiger, predicate = hasOwner, owner = Robert))
print("Pets.match(pet = Tiger, predicate = hasOwner, owner = Max): ",
      Pets.match(pet = Tiger, predicate = hasOwner, owner = Max))
print("Pets.count(predicate = hasOwner, owner = Robert): ",
      Pets.count(predicate = hasOwner, owner = Robert))
